{% extends "master.html" %}
{% block subtitle %} - 出入库管理 - 创建出入库单{% endblock %}

{% block extCSS %}
<style type="text/css">
    .template,.atmtemplate{
        display : none;
    }
</style>
{% endblock %}

{% block main %}
<div class="container">
    <div class="row">
        <ol class="breadcrumb">
          <li><a href="{{url_for('bpRoot.view')}}">主面板</a></li>
          <li><a href="{{url_for('bpIvtnt.view')}}">出入库管理</a></li>
          <li class="active">创建出入库单</li>
        </ol>
    </div>
    <div class="row">
        <div class="btn-toolbar pull-right">
                <div class="btn-group"><button class="btn btn-primary" onclick="$('form').submit()">{{BTN_SUBMIT}}</button></div>
        </div>
    </div>
    <div class="row">    
        <form class="form-horizontal" method='POST' action="{{url_for('.view',action='add')}}" enctype="multipart/form-data">
        <fieldset>
            <legend>出入库单详情</legend>
            <div class="col-md-6">
                 <div class="control-group controls-row">
                    <label for="remark" class="control-label"><label for="direction">出/入库</label></label>
                    <div class="controls">
                        <select name="direction" id="direction">
                            {% for d in [('',''),(IVTNT_IN,'入库'),(IVTNT_OUT,'出库')] %}
                                <option value="{{d[0]}}">{{d[1]}}</option>
                            {% endfor %}
                        </select>
                    </div>
                </div>
                <div class="control-group controls-row">
                    <label for="remark" class="control-label"><label for="refer">涉及</label></label>
                    <div class="controls"><input type="text" name="refer" id="refer"/></div>
                </div>
                <div class="control-group controls-row">
                    <label for="remark" class="control-label"><label for="remark">备注</label></label>
                    <div class="controls"><textarea name="remark" id="remark"></textarea></div>
                </div>
            </div>   
            <div class="col-md-6">
                <div class="control-group controls-row">
                    <label for="remark" class="control-label"><label for="createTime">日期</label></label>
                    <div class="controls"><input type="text" name="createTime" id="createTime" class="datepicker" value="{{now()|fd}}"/></div>
                </div>
                <div class="control-group controls-row">
                    <label for="remark" class="control-label"><label for="createTime">经办人</label></label>
                    <div class="controls"><input type="text" value="{{session['user_profile']['name']}}" readonly="true"/></div>
                </div>
                <div class="control-group controls-row">
                  <label class="control-label" for="attachment">附件</label>
                  <div class="controls">
                      <ul id="atmul" class="list-unstyled">
                          <li><input type="file" name="atm_10"/><a href="#" onclick="addAtm('atmtemplate','atmmk','#atmul')"><i class="glyphicon glyphicon-plus"></i></a></li>
                          <li class="atmtemplate"><input type="file" name="atm_x"/><a href="#" onclick="delAtm(this,'atmmk')"><i class="glyphicon glyphicon-minus"></i></a></li>
                      </ul>
                  </div>
                </div>
            </div>
        </fieldset>
            
                                  

        <table class="table table-bordered">
            <thead>
                <tr>
                    <td>商品编号</td>
                    <td>条码</td>
                    <td>商品名称</td>
                    <td>款号</td>
                    <td>证书号</td>
                    <td>数量</td>
                    <td>备注</td>
                </tr>
            </thead>
            <tbody>
                <tr>
                    <td>
                        <select name="product_10">
                            <option value=""></option>
                            {% for p in products %}
                                <option value="{{p.id}}">{{p}}</option>
                            {% endfor %}
                        </select>
                    </td>
                    <td></td>                            
                    <td></td>
                    <td></td>
                    <td></td>
                    <td><input type="text" name="qty_10" class="col-md-1 num"/></td>
                    <td><textarea name="remark_10" class="col-md-2"></textarea></td>
                </tr>
                <tr class="template">
                    <td>
                        <select name="product_x">
                            <option value=""></option>
                            {% for p in products %}
                                <option value="{{p.id}}">{{p}}</option>
                            {% endfor %}
                        </select>
                    </td>
                    <td></td>                            
                    <td></td>
                    <td></td>
                    <td></td>
                    <td><input type="text" name="qty_x" class="col-md-1 num"/></td>
                    <td><textarea name="remark_x" class="col-md-2"></textarea></td>
                </tr>
            </tbody>                
        </table>
        
        </form>
    </div>
    
   
</div>
{% endblock %}